package com.dupt.system.service.impl;

import java.util.List;
import com.dupt.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dupt.system.mapper.ProductLibraryMapper;
import com.dupt.system.domain.ProductLibrary;
import com.dupt.system.service.IProductLibraryService;

/**
 * 产品库Service业务层处理
 * 
 * @author zhuanyu.sun
 * @date 2025-07-10
 */
@Service
public class ProductLibraryServiceImpl implements IProductLibraryService
{
    @Autowired
    private ProductLibraryMapper productLibraryMapper;

    /**
     * 查询产品库
     * 
     * @param productLibraryId 产品库主键
     * @return 产品库
     */
    @Override
    public ProductLibrary selectProductLibraryByProductLibraryId(Long productLibraryId)
    {
        return productLibraryMapper.selectProductLibraryByProductLibraryId(productLibraryId);
    }

    /**
     * 查询产品库列表
     * 
     * @param productLibrary 产品库
     * @return 产品库
     */
    @Override
    public List<ProductLibrary> selectProductLibraryList(ProductLibrary productLibrary)
    {
        return productLibraryMapper.selectProductLibraryList(productLibrary);
    }

    /**
     * 新增产品库
     * 
     * @param productLibrary 产品库
     * @return 结果
     */
    @Override
    public int insertProductLibrary(ProductLibrary productLibrary)
    {
        productLibrary.setCreateTime(DateUtils.getNowDate());
        return productLibraryMapper.insertProductLibrary(productLibrary);
    }

    /**
     * 修改产品库
     * 
     * @param productLibrary 产品库
     * @return 结果
     */
    @Override
    public int updateProductLibrary(ProductLibrary productLibrary)
    {
        productLibrary.setUpdateTime(DateUtils.getNowDate());
        return productLibraryMapper.updateProductLibrary(productLibrary);
    }

    /**
     * 批量删除产品库
     * 
     * @param productLibraryIds 需要删除的产品库主键
     * @return 结果
     */
    @Override
    public int deleteProductLibraryByProductLibraryIds(Long[] productLibraryIds)
    {
        return productLibraryMapper.deleteProductLibraryByProductLibraryIds(productLibraryIds);
    }

    /**
     * 删除产品库信息
     * 
     * @param productLibraryId 产品库主键
     * @return 结果
     */
    @Override
    public int deleteProductLibraryByProductLibraryId(Long productLibraryId)
    {
        return productLibraryMapper.deleteProductLibraryByProductLibraryId(productLibraryId);
    }
}
